package com.atguigu.gulimall.auth.vo;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/**
 * @Classname UserRegisterVo
 * @Description TODO
 * @Date 2021/9/14 10:42
 * @Author Anonymous
 */
@SuppressWarnings("all")
@Data
public class UserRegisterVo {
    @NotNull(message = "用户名不能为空")
    @Length(min = 6, max = 20, message = "用户名长度必须在6-20之间")
    private String username;

    @NotNull(message = "密码不能为空")
    @Length(min = 6, max = 20, message = "用户名长度必须在6-20之间")
    private String password;
    //确认密码交给前端校验即可

    @NotNull(message = "手机号不能为空")
    @Pattern(regexp = "^[1]([3-9])[0-9]{9}$", message = "手机格式不正确")
    //"^[1]([3-9])[0-9]{9}$"中间的()小括号加不加都是可以
    //"^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$"
    //"^[1][3,4,5,7,8][0-9]{9}$"
    //常用的正则表达式以及测试：https://c.runoob.com/front-end/854/
    private String phone;

    @NotEmpty(message = "验证码必须填写")
    private String code;
    //JSR303数据校验 和@NotEmpty、@NotNull、@NotBlank的源码注释、区别
    //:参考链接：https://blog.csdn.net/m0_46539364/article/details/112132388
}
